{% extends 'base.html.twig' %}
{% block title %}{{ title }}{% endblock %}

{% block body %}
    <h2> {{ title }} </h2>
    <table class="table">
        <tr>
            <th>币种</th>
            <th>拉升时间</th>
            <th>当前价格</th>
            <th>通知时间</th>
            <th>id</th>
            <th>类型</th>
        </tr>

        {% for row in data %}
            {% if row['isIn5mins'] > 0 %}
                <tr style="background: #8A3104">
            {% else %}
                <tr style="background: #2a4137">
            {% endif %}
            <td onclick='openHuobi("{{ row["coin"] }}",true)'>{{ row['coin'] }}</td>
            <td>{{ row['coinTime'] }}</td>
            <td>{{ row['open'] }}</td>
            <td><a href="{{ url('huobi_calc_kline_cross') }}?coin={{ row["coin"] }}"
                   target="_blank">{{ row['ctime'] }}</a></td>
            <td>{{ prefix }}-{{ row['id'] }}</td>
            <td>{{ reportTypes[row['reportType']] |default('现货_买_Buy') }}</td>
            </tr>
        {% endfor %}
    </table>
{% endblock %}

{% block stylesheets %}
    <style type="text/css">
        body, table {
            background: #C0C0C0;
            font-size: 12px;

        }

        table {
            table-layout: fixed;
            empty-cells: show;
            border-collapse: collapse;
            margin: 0 auto;
        }

        td {
            height: 30px;
        }

        h1, h2, h3 {
            font-size: 12px;
            margin: 0;
            padding: 0;
        }

        .table {
            border: 1px solid #cad9ea;
            color: #FFFFFF;
        }

        .table th {
            background: #2b2b2b;
            background-repeat: repeat-x;
            height: 30px;
        }

        .table td, .table th {
            border: 1px solid #cad9ea;
            padding: 0 1em 0;
        }

        .table tr.alter {
            background-color: #f5fafe;
        }
    </style>
{% endblock %}

{% block metaes %}
    <meta http-equiv="refresh" content="10">
{% endblock %}
{% block javascripts %}
    <script type="text/javascript">
        function openHuobi(chStr, newWin) {
            var preg = /^([A-Za-z0-9]+)(btc|usdt|eth)$/i;

            chStr = chStr || 'btcusdt';
            newWin = newWin || false;
            var matches = chStr.match(preg);
            if (matches == null) return;

            var url = 'https://www.huobi.br.com/zh-cn/' + matches[1] + '_' + matches[2] + '/exchange/';
            if (newWin) {
                window.open(url);
            }
            else {
                window.location.href = url;
            }
        }
    </script>
{% endblock %}
